<script>
import Editor from '@tinymce/tinymce-vue'

export default {
  data () {
    return {
      htmlStr: ''
    }
  },
  methods: {
    change (event) {
      console.log('12345678', event.level.content);
      // 获取富文本编辑器中的内容
      this.htmlStr = event.level.content
    }
  },
  components: {
    Editor
  }
}
</script>
<template>
  <div>
    <main id="sample">
      <Editor @change="change" api-key="no-api-key" :init="{
        plugins: 'lists link image table code help wordcount'
      }" />
    </main>

    <div v-html="htmlStr"></div>
  </div>
</template>
